package system

import (
	"database/sql"
	//	"fmt"
	"github.com/garyburd/redigo/redis"
	_ "github.com/go-sql-driver/mysql"
)

var Db *sql.DB

func InitDb() {
	//	fmt.Println(&Db)
	var err error
	Db, err = sql.Open("mysql", "root:root@tcp(localhost:3306)/ads?charset=utf8")

	if err != nil {
		panic(err.Error())
		return
	}
	//	defer Db.Close()
}

var Redis redis.Conn

func InitRedis() {
	var err error
	Redis, err = redis.Dial("tcp", "127.0.0.1:6379")
	if err != nil {
		panic(err.Error())
		return
	}
}
